package cn.cmcc.intertelecom.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.cmcc.intertelecom.bean.Daily;
import cn.cmcc.intertelecom.bean.DailyExample;
import cn.cmcc.intertelecom.bean.DailyExample.Criteria;
import cn.cmcc.intertelecom.bean.Power;
import cn.cmcc.intertelecom.bean.User;
import cn.cmcc.intertelecom.dao.DailyMapper;

/**
 * 用于日志的增删改查操作
 * @author wp
 *
 */
@Service
public class DailyService {
	@Autowired
	private DailyMapper dailyMapper;

	/**
	 * 根据条件 查询 的日志
	 * @param daily
	 * @return
	 */
	public List<Daily> selectAllWithOther(Daily daily) {
		DailyExample example =new DailyExample();
		Criteria criteria = example.createCriteria();
		if(daily.getId() != null && !daily.getId().equals("")){
			criteria.andIdEqualTo(daily.getId());
		}
		if(daily.getUserId() !=null && !daily.getUserId().equals("")){
			criteria.andUserIdEqualTo(daily.getUserId());
		}
		if(daily.getModuleId() !=null && !daily.getModuleId().equals("")){
			criteria.andModuleIdEqualTo(daily.getModuleId());
		}
		return dailyMapper.selectByExampleWithOther(example );
	}
	
	/**
	 * 存入日志
	 * @param daily
	 */
	public void insertDaily(Daily daily) {
		dailyMapper.insert(daily);
		
	}

	

}
